package com.ishare.common.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.ishare.common.constant.Constant;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Date;

/**
 * 基础实体类
 */
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = -1001470871112120797L;

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @TableField(value = "create_by", fill = FieldFill.INSERT)
    public String createBy;

    /**
     * 修改人
     */
    @ApiModelProperty(value = "修改人")
    @TableField(value = "update_by", fill = FieldFill.UPDATE)
    public String updateBy;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    public Date createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "修改时间")
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private Date updateTime;

    /**
     * 创建ip
     */
    @ApiModelProperty(value = "创建ip")
    @TableField(value = "create_ip", fill = FieldFill.INSERT)
    public String createIp;

    /**
     * 修改ip
     */
    @ApiModelProperty(value = "修改ip")
    @TableField(value = "update_ip", fill = FieldFill.UPDATE)
    public String updateIp;

    /**
     * 逻辑删除
     */
    @ApiModelProperty(value = "逻辑删除标志(做删除操作是会作为修改方法 )0不删除，-1已经删除")
    @TableLogic(value = Constant.NORMAL, delval = Constant.DEL)
    @TableField(value = "status", fill = FieldFill.INSERT_UPDATE)
    private Integer status;

    public BaseEntity() {
    }

    public BaseEntity(String createBy, String updateBy, Date createTime, Date updateTime, String createIp, String updateIp, Integer status) {
        this.createBy = createBy;
        this.updateBy = updateBy;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createIp = createIp;
        this.updateIp = updateIp;
        this.status = status;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getCreateIp() {
        return createIp;
    }

    public void setCreateIp(String createIp) {
        this.createIp = createIp;
    }

    public String getUpdateIp() {
        return updateIp;
    }

    public void setUpdateIp(String updateIp) {
        this.updateIp = updateIp;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "BaseEntity{" +
                "createBy='" + createBy + '\'' +
                ", updateBy='" + updateBy + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", createIp='" + createIp + '\'' +
                ", updateIp='" + updateIp + '\'' +
                ", status=" + status +
                '}';
    }
}
